Fix ODR violations discovered when using -flto. (#824)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Wed, 26 Jan 2022 00:06:49 +0000 (17:06 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Jan 2022 00:06:49 +0000 (17:06 -0700)
commit05afc0d40bf4fc628537cf9d4069f30334931af0
tree97167388bda0a932799d024b7dadb75496755771
parent5bcbc0bbd258258c230148142d46365d2e687345
Fix ODR violations discovered when using -flto. (#824)

The fedora build shows these:
skytraq.cc:666:8: warning: type 'struct read_state' violates the C++ One Definition Rule [-Wodr]
wbt-200.cc:127:8: note: a different type is defined in another translation unit
brauniger_iq.cc:30:6: warning: type 'state_t' violates the C++ One Definition Rule [-Wodr]
igc.cc:150:6: note: an enum with different value name is defined in another translation unit

However, even with link time optimization I was unable to observe a problem, i.e. testo passes.

There is a relevant note in https://en.cppreference.com/w/cpp/language/definition, see the note
about using unnamed namespaces to resolve this issue.

Also note the use of unnamed namespaces is not recommended in header files,
https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL59-CPP.+Do+not+define+an+unnamed+namespace+in+a+header+file
brauniger_iq.cc
igc.cc
skytraq.cc
wbt-200.cc